*Open Log file
log using "/Users/JTAFOYA1/My Drive/Research/Englishness_Americanness/CCES18_UTAustin_OUTPUTB.log", replace

*Replication Files for "Divid Images: How the English Percieve Nationhood and How This Shapes Voting and Opinion"
*Eric Kaufmann, Birkbeck College, University of London, UK 
*David L. Leal, University of Texas at Austin, USA 
*Joe R. Tafoya, DePaul University, Chicago, USA 

*Part 2 of 2, focused on the US

*Author of this code: Joe R. Tafoya, PhD (j.tafoya@depaul.edu)

*Platform: STATA


use "/Users/JTAFOYA1/My Drive/Research/Englishness_Americanness/Graph and Program Files/CCES18_UTAustin_OUTPUTB.dta", clear

set more off

svyset[pweight=teamweight]

/*Question Prompt: A foreign tourist wrote up this list of 
things that struck him as typically American. For each one, don't tell us 
whether you like it or not, but instead tell us how American it makes you feel,
from 0 (not at all) to 100 (very much).
*/
{
*Cowboys
tab UTB334_1
tab UTB334_1, nolab
decode UTB334_1, gen(cow)
destring cow, gen(cowboys)
*replace cowboys=cowboys/100
tab cowboys
sum cowboys

*American Countryside
tab UTB334_2
tab UTB334_2, nolab
decode UTB334_2, gen(coun)
destring coun, gen(country)
*replace country=country/100
tab country

*Pickup Trucks
tab UTB334_3
tab UTB334_3, nolab
decode UTB334_3, gen(pickup)
destring pickup, gen(truck)
*replace truck=truck/100
tab truck

*Diverse Mix of Ethnic and Racial Groups
tab UTB334_4
tab UTB334_4, nolab
decode UTB334_4, gen(mix)
destring mix, gen(diverse)
*replace diverse=diverse/100
tab diverse

*Alternative neighborhoods like...
tab UTB334_5
tab UTB334_5, nolab
decode UTB334_5, gen(alter)
destring alter, gen(hoods)
*replace hoods=hoods/100
tab hoods

*American History
tab UTB334_6
tab UTB334_6, nolab
decode UTB334_6, gen(hist)
destring hist, gen(history)
*replace history=history/100
tab history

*Baseball
tab UTB334_7
tab UTB334_7, nolab
decode UTB334_7, gen(base)
destring base, gen(baseball)
*replace baseball=baseball/100
tab baseball

*The Armed Forces
tab UTB334_8
tab UTB334_8, nolab
decode UTB334_8, gen(arm)
destring arm, gen(armed)
*replace armed=armed/100
tab armed

*National Parks
tab UTB334_9
tab UTB334_9, nolab
decode UTB334_9, gen(nat)
destring nat, gen(national)
*replace national=national/100
tab national

*Immigrants
tab UTB334_10
tab UTB334_10, nolab
decode UTB334_10, gen(immig)
destring immig, gen(immigrant)
*replace immigrant=immigrant/100
tab immigrant

*Football
tab UTB334_11
tab UTB334_11, nolab
decode UTB334_11, gen(foot)
destring foot, gen(football)
*replace football=football/100
tab football

*Basketball
tab UTB334_12
tab UTB334_12, nolab
decode UTB334_12, gen(bask)
destring bask, gen(basketball)
*replace basketball=basketball/100
tab basketball

*Hockey
tab UTB334_13
tab UTB334_13, nolab
decode UTB334_13, gen(hock)
destring hock, gen(hockey)
*replace hockey=hockey/100
tab hockey

factor UTB334_* // 2 factors; 6.37 #1, 1.15 #2

factor cowboys country truck diverse hoods history baseball armed national ///
immigrant football basketball hockey // 2 factors; 6.31 #1, 1.15 #2


// Factor 1 (all above cut off but limited by Factor)
factor cowboys country truck history armed
alpha cowboys country truck history armed, gen(factor1) // Eigen 2.89; .88 Alpha
sum factor1
hist factor1
lab var factor1 "Traditional"

// Factor 2 (above cut off of .4)
factor diverse hoods national immigrant // Diverse mix, alternative neighborhoods, national parks, immigrants
alpha diverse hoods national immigrant, gen(factor2) // Eigen 2.15, .83 Alpha
sum factor2
hist factor2
lab var factor2 "Experiences"

// Factor 3 (Sports only)
factor baseball football basketball hockey
alpha baseball football basketball hockey, gen(factor3) // Eigen 2.66; .89 Alpha
sum factor3
hist factor3
lab var factor3 "Sports"
}
*Demographics
{
*Age
tab birthyr
gen age=2018-birthyr
*replace age=(age-18)/(88-18)
tab age,m
lab var age "Age"

*Education
tab educ
recode educ 1/2=1 3/4=2 5=3 6=4, gen(education)
*replace education=(education-1)/3
tab education,m
lab var education "Education"

*Income
tab faminc,m
tab faminc, nolab
recode faminc 17=., gen(income)
lab var income "Income"

*Female
tab gender
recode gender 1=0 2=1, gen(female)
tab female
lab var female "Female"

*Race
tab race hispanic,m
replace race=3 if hispanic==1
recode race 4/8=4
lab var race "Race/Ethnicity"
lab define racel1 1 "White" 2 "Black" 3"Latino" 4"Other"
lab value race racel1
tab race

*White/Non-White
recode race 1=1 else=0, gen(white)
tab white
lab var white "White"
lab define white1 0 "Non-White" 1 "White"
lab value white white1
tab white

*PID
tab pid7,m
tab pid7, nolab
recode pid7 8=., gen (pid)
lab var pid "Party ID"

*3-PID: 37 "Not Sure" and missing coded as Independent
drop pid3
recode pid7 1/3=1 4=2 5/7=3 8=2 .=2, gen(pid3)
tab pid pid3,m
lab var pid3 "Part ID"
lab def pid32 1"Democrat" 2"Independent" 3"Republican"
lab val pid3 pid32
recode pid3 3=1 else=0, gen(rep)
tab rep
lab var rep "Republican"

*Ideology
tab ideo5,m
tab ideo5, nolab
recode ideo5 6=., gen(ideology)
tab ideology
lab var ideology "Political Ideology"

recode ideology 4/5=1 else=0, gen(conservative)
tab conservative
lab var conservative "Conservative"
lab define conservative1 0 "Non-Conservative" 1 "Conservative"
lab value conservative conservative1
tab conservative

*Ideology
recode ideology 1/2=1 3=2 4/5=3, gen(ideo3)
tab ideo3

*Political News Interest
tab newsint
recode newsint 1=4 2=3 3=2 4=1 5=1, gen(interest)
tab interest
lab var interest "Political Attention"

*Vote for President 2016
tab CC18_317
recode CC18_317 1=1 2=0 else=., gen(trump)

*Congressional vote
tab CC18_412
recode CC18_412 2=1 1=0 else=.,gen(republican)
tab republican

*Border Security spending ($25 million) + Wall between US/Mexico
tab CC18_322a
recode CC18_322a 1=1 2=0, gen(wall)
tab wall

*Religiousness
tab religpew, nolab
recode religpew 9/11=0 else=1, gen(religious)
tab religious
lab var religious "Religious"
lab define religious1 0 "Non-Religious" 1 "Religious"
lab value religious religious1
tab religious

}

**Figure 1: "US: Frame Clusterings"

graph bar (mean) factor1 factor2 factor3 [pweight=teamweight], ysc(r(1) ///
titleg(1)) ylab(0(25)100) blabel(bar, position(center) format(%4.0g) size(3) ///
color(white)) title(US: Frame Clusterings) bargap(30) ///
legend(label(1 "Traditional Frames") label(2 "Experiences Frames") ///
label(3 "Sports Frames") size(3) rowgap(*.45) pos(6) rows(1) ///
region(style(legend) fcolor(gs15) margin(medsmall)) colgap(*.75) ///
symxsize(*.75) keygap(*.33)) ytitle(thermometer) note("Factor 1 Eigenvalue: Cultural (2.89), Experiences (2.15), Sports (2.66)" "Scale Reliability: Cultural (.82), Sports (.89), Experiences (.83). Source: 2018 CCES (UT Austin)" , size(3) pos(6))
graph save cluster1.gph, replace	


*Figure 2: "US: Cultural Frames"

graph bar (mean) history armed country truck cowboys [pweight=teamweight], ///
title(Aggregate) ysc(r(1) titleg(1)) ylab(0(25)100) ///
blabel(bar, position(center) ///
format(%4.0g) size(3) color(white)) bargap(30) legend(label(1 "American history") ///
label(2 "The armed forces") label(3 "The american countryside") ///
label(4 "Pickup trucks") label(5 "Cowboys") size(2.5) rowgap(*.45) pos(6) rows(2) ///
region(style(legend) fcolor(gs15) margin(medsmall))) ytitle(thermometer)
graph save cultural1.gph, replace	
	
	*Cultural*Race
	graph bar (mean) history armed country truck cowboys ///
	[pweight=teamweight], over(white) title(Race) ysc(r(1) ///
	titleg(1)) ylab(0(25)100) blabel(bar, position(center) ///
	format(%4.0g) size(3) color(white)) bargap(-15) ///
	legend(label(1 "American history") label(2 "The armed forces") ///
	label(3 "The american countryside") label(4 "Pickup trucks") ///
	label(5 "Cowboys") size(2.5) rowgap(*.45) pos(6) rows(2) ///
	region(style(legend) fcolor(gs15) margin(medsmall))) ytitle(thermometer)
	graph save cultural2.gph, replace
	
	*Cultural*Ideology
	graph bar (mean) history armed country truck cowboys ///
	[pweight=teamweight], over(conservative) title(Ideology) ///
	ysc(r(1) titleg(1)) ylab(0(25)100) blabel(bar, position(center) ///
	format(%4.0g) size(3) color(white)) bargap(-15) ytitle(thermometer) ///
	legend(label(1 "American history") label(2 "The armed forces") ///
	label(3 "The american countryside") label(4 "Pickup trucks") ///
	label(5 "Cowboys") size(2.5) rowgap(*.45) pos(6) rows(2))
	graph save cultural3.gph, replace
	
	*Cultural*Religion
	graph bar (mean) history armed country truck cowboys ///
	[pweight=teamweight], over(religious) title(Religiosity) ///
	ysc(r(1) titleg(1)) ylab(0(25)100) blabel(bar, position(center) ///
	format(%4.0g) size(3) color(white)) bargap(-15) ///
	legend(label(1 "American history") label(2 "The armed forces") ///
	label(3 "The american countryside") label(4 "Pickup trucks") ///
	label(5 "Cowboys") size(2.5) rowgap(*.45) pos(6) rows(2) ///
	region(style(legend) fcolor(gs15) margin(medsmall))) ytitle(thermometer)
	graph save cultural4.gph, replace
	
	grc1leg cultural1.gph cultural2.gph cultural3.gph cultural4.gph, ycommon ///
	col(2) title("US: Cultural Frames") note("Source: 2018 CCES (UT Austin)" ///
	, pos(6))

	
**Figure 3: "Cultural Frames: Mean scores by Party ID"
	
*Cultural*Partisanship
graph bar (mean) history armed country truck cowboys ///
[pweight=teamweight], over(pid3) title(Cultural Frames) subtitle("Mean scores by Party ID") ysc(r(1) titleg(1)) ylab(0(25)100) blabel(bar, position(center) ///
format(%4.0g) size(3) color(white)) bargap(-15) ytitle(thermometer) ///
legend(label(1 "American history") label(2 "The armed forces") ///
label(3 "The american countryside") label(4 "Pickup trucks") ///
label(5 "Cowboys") size(2.5) rowgap(*.45) pos(6) rows(2)) ///
note("Source: 2018 CCES (UT Austin)", pos(6))
graph save cultural5.gph, replace	
	

**Figure 4: US: Experiences Frames
	
*Experiences
graph bar (mean) national diverse immigrant hoods [pweight=teamweight], ///
title(Aggregate) ysc(r(1) titleg(1)) ylab(0(25)100) ///
blabel(bar, position(center) format(%4.0g) size(3) color(white)) bargap(30) ///
legend(label(1 "National Parks") label(2 "Diverse mix of groups") ///
label(3 "Immigrants") label(4 "Alternative neighborhoods") size(2.5) ///
rowgap(*.45) pos(6) rows(2) region(style(legend) fcolor(gs15) ///
margin(medsmall))) ytitle(thermometer)
graph save experiences1.gph, replace	

	*Experiences*Race
	graph bar (mean) national diverse immigrant hoods [pweight=teamweight], ///
	over(white) title(Race) ysc(r(1) titleg(1)) ylab(0(25)100) ///
	blabel(bar, position(center) format(%4.0g) size(3) color(white)) ///
	bargap(-15) legend(label(1 "National Parks") ///
	label(2 "Diverse mix of groups") label(3 "Immigrants") ///
	label(4 "Alternative neighborhoods") size(2.5) rowgap(*.45) pos(6) ///
	rows(2) region(style(legend) fcolor(gs15) margin(medsmall))) ///
	ytitle(thermometer)
	graph save experiences2.gph, replace	
	
	*Experiences*Ideology
	graph bar (mean) national diverse immigrant hoods [pweight=teamweight], ///
	over(conservative) title(Ideology) ysc(r(1) titleg(1)) ylab(0(25)100) ///
	blabel(bar, position(center) format(%4.0g) size(3) color(white)) ///
	bargap(-15) legend(label(1 "National Parks") ///
	label(2 "Diverse mix of groups") label(3 "Immigrants") ///
	label(4 "Alternative neighborhoods") size(2.5) rowgap(*.45) pos(6) ///
	rows(2) region(style(legend) fcolor(gs15) margin(medsmall))) ///
	ytitle(thermometer)
	graph save experiences3.gph, replace		

	*Experiences*Religious
	graph bar (mean) national diverse immigrant hoods [pweight=teamweight], ///
	over(religious) title(Religiosity) ysc(r(1) titleg(1)) ylab(0(25)100) ///
	blabel(bar, position(center) format(%4.0g) size(3) color(white)) ///
	bargap(-15) legend(label(1 "National Parks") ///
	label(2 "Diverse mix of groups") label(3 "Immigrants") ///
	label(4 "Alternative neighborhoods") size(2.5) rowgap(*.45) pos(6) ///
	rows(2) region(style(legend) fcolor(gs15) margin(medsmall))) ///
	ytitle(thermometer)
	graph save experiences4.gph, replace	
	
	grc1leg experiences1.gph experiences2.gph experiences3.gph ///
	experiences4.gph, ycommon col(2) title("US: Experiences Frames") ///
	note("Source: 2018 CCES (UT Austin)", pos(6))


**Figure 5: "Experiences Frames"

*Experiences*Ideology
graph bar (mean) national diverse immigrant hoods [pweight=teamweight], ///
over(pid3) title(Experience Frames) subtitle("Mean scores by Party ID") ysc(r(1) titleg(1)) ylab(0(25)100) blabel(bar, position(center) format(%4.0g) size(3) color(white)) bargap(-15) legend(label(1 "National Parks") ///
label(2 "Diverse mix of groups") label(3 "Immigrants") ///
label(4 "Alternative neighborhoods") size(2.5) rowgap(*.45) pos(6) ///
rows(2) region(style(legend) fcolor(gs15) margin(medsmall))) ///
ytitle(thermometer) note("Source: 2018 CCES (UT Austin)", pos(6))
graph save experiences5.gph, replace

	
**Figure 6: "US: Sport Frames"	
	
*Sports
graph bar (mean) baseball football basketball hockey [pweight=teamweight], ///
title(Aggregate) ysc(r(1) titleg(1)) ylab(0(25)100) blabel(bar, ///
position(center) format(%4.0g) size(3) color(white)) bargap(30) ///
legend(label(1 "Baseball") label(2 "Football") label(3 "Basketball") ///
label(4 "Hockey") size(2.5) rowgap(*.45) pos(6) rows(1) region(style(legend) ///
fcolor(gs15) margin(medsmall)) colgap(*.75) symxsize(*.75) keygap(*.33)) ///
ytitle(thermometer) 
graph save sports1.gph, replace	

	*Sports*Race
	graph bar (mean) baseball football basketball hockey ///
	[pweight=teamweight], over(white) title(Race) ysc(r(1) titleg(1)) ///
	ylab(0(25)100) blabel(bar, position(center) format(%4.0g) size(3) ///
	color(white)) bargap(-15) legend(label(1 "Baseball") label(2 "Football") ///
	label(3 "Basketball") label(4 "Hockey") size(2.5) rowgap(*.45) pos(6) ///
	rows(1) region(style(legend) fcolor(gs15) margin(medsmall)) colgap(*.75) ///
	symxsize(*.75) keygap(*.33)) ytitle(thermometer)
	graph save sports2.gph, replace	
	
	*Sports*Ideology
	graph bar (mean) baseball football basketball hockey ///
	[pweight=teamweight], over(conservative) title(Ideology) ysc(r(1) ///
	titleg(1)) ylab(0(25)100) blabel(bar, position(center) format(%4.0g) ///
	size(3) color(white)) bargap(-15) legend(label(1 "Baseball") ///
	label(2 "Football") label(3 "Basketball") label(4 "Hockey") size(2.5) ///
	rowgap(*.45) pos(6) rows(1) region(style(legend) fcolor(gs15) ///
	margin(medsmall)) colgap(*.75) symxsize(*.75) keygap(*.33)) ///
	ytitle(thermometer)
	graph save sports3.gph, replace	
	
	*Sports*Religiosity
	graph bar (mean) baseball football basketball hockey ///
	[pweight=teamweight], over(religious) title(Religiosity) ysc(r(1) ///
	titleg(1)) ylab(0(25)100) blabel(bar, position(center) format(%4.0g) ///
	size(3) color(white)) bargap(-15) legend(label(1 "Baseball") ///
	label(2 "Football") label(3 "Basketball") label(4 "Hockey") size(2.5) ///
	rowgap(*.45) pos(6) rows(1) region(style(legend) fcolor(gs15) ///
	margin(medsmall)) colgap(*.75) symxsize(*.75) keygap(*.33)) ///
	ytitle(thermometer)
	graph save sports4.gph, replace		

	grc1leg sports1.gph sports2.gph sports3.gph sports4.gph, ycommon col(2) ///
	title("US: Sport Frames") note("Source: 2018 CCES (UT Austin)", pos(6))
	
	
*Figure 7: "Sport Frames: Means scores by Party ID"	

*Sports*Partisanship
graph bar (mean) baseball football basketball hockey [pweight=teamweight], ///
over(pid3) title(Sport Frames) subtitle(Mean scores by Party ID) ysc(r(1) ///
titleg(1)) ylab(0(25)100) blabel(bar, position(center) format(%4.0g) ///
size(3) color(white)) bargap(-15) legend(label(1 "Baseball") ///
label(2 "Football") label(3 "Basketball") label(4 "Hockey") size(2.5) ///
rowgap(*.45) pos(6) rows(1) region(style(legend) fcolor(gs15) ///
margin(medsmall)) colgap(*.75) symxsize(*.75) keygap(*.33)) ///
ytitle(thermometer) note("Source: 2018 CCES (UT Austin)", pos(6))
graph save sports5.gph, replace		
	
	
**Figure 8: "US: Frame Clusterings by Partisanship"
	
*Factor*Partisanship
graph bar (mean) factor1 factor2 factor3 [pweight=teamweight], ///
over(pid3) ysc(r(1) titleg(1)) ylab(0(25)100) blabel(bar, ///
position(center) format(%4.0g) size(3) color(white)) ///
title(US: Frame Clusterings by Partisanship) ///
bargap(-15) legend(label(1 "Traditional Frames") ///
label(2 "Experiences Frames") label(3 "Sports Frames") size(3) ///
rowgap(*.45) pos(6) rows(1) region(style(legend) fcolor(gs15) ///
margin(medsmall)) colgap(*.75) symxsize(*.75) keygap(*.33)) ///
ytitle(thermometer) note("Source: 2018 CCES (UT Austin)", pos(6))
graph save cluster3.gph, replace	
	
	
**Figure 9: "US: Frame Clusterings by Non-White/White"
	
*Factor*Gender
graph bar (mean) factor1 factor2 factor3 [pweight=teamweight], ///
over(white) ysc(r(1) titleg(1)) ylab(0(25)100) blabel(bar, ///
position(center) format(%4.0g) size(3) color(white)) ///
title(US: Frame Clusterings by Non-White/White) ///
bargap(-15) legend(label(1 "Traditional Frames") ///
label(2 "Experiences Frames") label(3 "Sports Frames") size(3) ///
rowgap(*.45) pos(6) rows(1) region(style(legend) fcolor(gs15) ///
margin(medsmall)) colgap(*.75) symxsize(*.75) keygap(*.33)) ///
ytitle(thermometer) note("Source: 2018 CCES (UT Austin)", pos(6))
graph save cluster3.gph, replace	
		
		
**Figure 10: "US: Predictors of Frame Clusterings"	

svy: reg factor1 age education income female interest i.white i.conservative ///
i.rep i.religious
eststo a
svy: reg factor2 age education income female interest i.white i.conservative ///
i.rep i.religious
eststo b
svy: reg factor3 age education income female interest i.white i.conservative ///
i.rep i.religious	
eststo c
	
coefplot (a, label(Traditional Frames)) (b, label(Experiences Frames)) ///
(c, label(Sports Frames)) , drop(_cons) xline(0) bycoefs legend(size(3) ///
rowgap(*.45) pos(6) rows(1) region(style(legend) fcolor(gs15) margin(medsmall)))


**Figure 11: "US: Vote Choice/Policy"

svy: logit wall factor1 factor2 factor3 age education income female ///
interest i.conservative pid white religious
eststo wall1

svy: logit trump factor1 factor2 factor3 age education income female ///
interest i.conservative pid white religious
eststo trump1

coefplot (trump1, label("Trump '16"))  ///
(wall1, label("Border Wall")),  drop(_cons) ///
ysize(8) xline(0) nolabels byopts(legend(on)) ///
coefl(factor1="Traditional" factor2="Experiences" factor3="Sports" ///
age="Age" education="Education" income="Income" female="Female" ///
interest="Pol. Interest" white="White" 1.conservative="Conservative" ///
religious="Religiosity" pid="Party ID")	title("US: Vote Choice/Policy") ///
subtitle ("Logistic Regression Coefficients, 95% CIs")	///
note("Source: 2018 CCES (UT Austin)", pos(6))


**Figure 12: "US: Effect of National Frames on Support for Border Wall"

svy: logistic wall factor1 factor2 factor3 age education income female ///
interest ideology pid i.race
eststo wall

margins, at(factor1=(0(20)100))
marginsplot, title("Traditional Frames") ytitle("Pr(Support)") legend(off) ///
xtitle("thermometer") ylabel(0(.20)1) note("Positive significant effect", pos(6))
graph save 1.gph, replace

margins, at(factor2=(0(20)100))
marginsplot, title("Value Frames") ytitle("Pr(Support)") ///
xtitle("thermometer") ylabel(0(.20)1) note("Negative significant effect", pos(6))
graph save 2.gph, replace

margins, at(factor3=(0(20)100))
marginsplot, title("Sport Frames") ytitle("Pr(Support)") ///
xtitle("thermometer") ylabel(0(.20)1) note("No significant effect", pos(6))
graph save 3.gph, replace

	grc1leg 1.gph 2.gph 3.gph, ycommon col(3) legendfrom(1.gph) ///
	title("US: Effect of National Frames on Support for Border Wall") ///
	subtitle("Marginal Predictions w/95% CIs") ///
	note("Source: 2018 CCES (UT Austin)", pos(6)) 
	
	
**Figure 13: "US: Effect on National Frames on Trump Vote '16"

svy: logit trump factor1 factor2 factor3 age education income female ///
interest ideology pid i.race
eststo trump

margins, at(factor1=(0(20)100))
marginsplot, title("Traditional Frames") ytitle("Pr(Voted)") ///
xtitle("thermometer") ylabel(0(.20)1) note("No significant effect", pos(6))
graph save 1.gph, replace

margins, at(factor2=(0(20)100))
marginsplot, title("Value Frames") ytitle("Pr(Voted)") ///
xtitle("thermometer") ylabel(0(.20)1) note("Negative significant effect", pos(6))
graph save 2.gph, replace

margins, at(factor3=(0(20)100))
marginsplot, title("Sport Frames") ytitle("Pr(Voted)") ///
xtitle("thermometer") ylabel(0(.20)1) note("No significant effect", pos(6))
graph save 3.gph, replace

	grc1leg 1.gph 2.gph 3.gph, ycommon col(3) ///
	title("US: Effect of National Frames on Trump Vote '16") ///
	subtitle("Marginal Predictions w/95% CIs") ///
	note("Source: 2018 CCES (UT Austin)", pos(6)) 
	
	
**Figure 14: "Marginal Effects of Experiences Frames"	
	
svy: logistic trump i.white##c.factor1 i.white##c.factor2 ///
i.white##c.factor3 age education income female interest i.conservative ///
pid religious
eststo trump2

	margins white, dydx(factor2) predict(pr)
	margins white, at(factor2=(0(20)100)) predict(pr)
	marginsplot, title("Voted Trump") xtitle("Experiences Frames") ///
	ylab(0(.20)1) ytitle("Pr(Vote=1)") yline(.50, lpattern(dot))
	graph save trump2.gph, replace		

svy: logistic wall i.white##c.factor1 i.white##c.factor2 ///
i.white##c.factor3 age education income female interest i.conservative ///
pid religious
eststo wall2	

	margins white, dydx(factor2) predict(pr)
	margins white, at(factor2=(0(20)100)) predict(pr)
	marginsplot, title("Border Wall") ///
	xtitle("Experiences Frames") ylab(0(.20)1) ytitle("Pr(Support=1)") ///
	yline(.50, lpattern(dot))
	graph save wall2.gph, replace	
	
	grc1leg trump2.gph wall2.gph, ycommon col(2) ///
	title("Marginal Effects of Experiences Frames") ///
	subtitle("by Group ID w/95% CIs") note("Source: 2018 CCES (UT Austin)", pos(6))
	
	
**Figure 15: "Marginal Effects of Experiences Frames"
	
svy: logistic trump i.conservative##c.factor1 i.conservative##c.factor2 ///
i.conservative##c.factor3 age education income female interest i.white ///
pid religious
eststo trump3

	margins conservative, dydx(factor1) predict(pr)
	margins conservative, at(factor1=(0(20)100)) predict(pr)
	marginsplot, title("Voted Trump") xtitle("Traditional Frames") ///
	ylab(0(.20)1) ytitle("Pr(Vote=1)") yline(.50, lpattern(dot))
	graph save trump3.gph, replace	
	
svy: logistic wall i.conservative##c.factor1 i.conservative##c.factor2 ///
i.conservative##c.factor3 age education income female interest i.white ///
pid religious
eststo wall3

	margins conservative, dydx(factor1) predict(pr)
	margins conservative, at(factor1=(0(20)100)) predict(pr)
	marginsplot, title("Border Wall") xtitle("Traditional Frames") ///
	ylab(0(.20)1) ytitle("Pr(Support=1)") yline(.50, lpattern(dot))
	graph save wall3.gph, replace	
	
	grc1leg trump3.gph wall3.gph, ycommon col(2) ///
	title("Marginal Effects of Experiences Frames") ///
	subtitle("by Group ID w/95% CIs") ///
	note("Source: 2018 CCES (UT Austin)", pos(6))	
	
		
**Figure 16: "Marginal Effect of Sports and Traditional Frames"

svy: logistic wall i.conservative##c.factor1 i.conservative##c.factor2 ///
i.conservative##c.factor3 age education income female interest i.white ///
pid religious
eststo wall3

	margins conservative, dydx(factor3) predict(pr)	
	margins conservative, at(factor3=(0(20)100)) predict(pr)
	marginsplot, title("Border Wall") xtitle("Sports Frames") ///
	ylab(0(.20)1) ytitle("Pr(Support=1)") yline(.50, lpattern(dot))
	graph save wall3a.gph, replace
	
svy: logistic wall i.religious##c.factor1 i.religious##c.factor2 ///
i.religious##c.factor3 age education income female interest i.white pid ///
conservative
eststo wall4

	margins religious, dydx(factor1) predict(pr)
	margins religious, at(factor1=(0(20)100)) predict(pr)
	marginsplot, title("Border Wall") xtitle("Traditional Frames") ///
	ylab(0(.20)1) ytitle("Pr(Support=1)") yline(.50, lpattern(dot))
	graph save wall4a.gph, replace
	
	graph combine wall3a.gph wall4a.gph, ycommon col(2) ///
	title("Marginal Effects of Sports and Traditional Frames") ///
	subtitle("by Group ID w/95% CIs") ///
	note("Source: 2018 CCES (UT Austin)", pos(6))	
	
		
**Table 1: Predictors of US Frame Clusters, Linear Regression Estimates		

esttab a b c using regression.rtf, replace nogap ///
onecell title("Predictors of US Frame Clusterings, Linear Regression Estimates") ///
nonumbers mtitles("Traditional" "Experiences" "Sports") ///
addnote("Source: 2008 CCES UT Austin Module") incelldelimiter( ) compress ///
label nobaselevels star (+ .10 * .05 ** .01 *** .001) se(2) b(2) noeqlines	

**Table 2: Predictors of UK Frame Clusters (See Part 1 code)


**Figure 17: "Cultural Frames: Mean scores by Group ID"

graph bar (mean) history armed country truck cowboys ///
[pweight=teamweight], over(race) title(Cultural Frames) ///
subtitle("Mean scores by Group ID") ysc(r(1) ///
titleg(1)) ylab(0(25)100) blabel(bar, position(center) ///
format(%4.0g) size(3) color(white)) bargap(-15) ///
legend(label(1 "American history") label(2 "The armed forces") ///
label(3 "The american countryside") label(4 "Pickup trucks") ///
label(5 "Cowboys") size(2.5) rowgap(*.45) pos(6) rows(2) ///
region(style(legend) fcolor(gs15) margin(medsmall))) ytitle(thermometer) ///
note("Source: 2018 CCES (UT Austin)", pos(6))
graph save cultural2.gph, replace
		
		
**Figure 18: Experiences Frames: Mean scores by Group ID"

graph bar (mean) national diverse immigrant hoods [pweight=teamweight], ///
over(race) title(Sport Frames) ///
subtitle("Mean scores by Group ID") ysc(r(1) titleg(1)) ylab(0(25)100) ///
blabel(bar, position(center) format(%4.0g) size(3) color(white)) ///
bargap(-15) legend(label(1 "National Parks") ///
label(2 "Diverse mix of groups") label(3 "Immigrants") ///
label(4 "Alternative neighborhoods") size(2.5) rowgap(*.45) pos(6) ///
rows(2) region(style(legend) fcolor(gs15) margin(medsmall))) ///
ytitle(thermometer) note("Source: 2018 CCES (UT Austin)", pos(6))
graph save experiences2.gph, replace	

		
**Figure 19: "Sport Frames: Mean scores by Group ID"

graph bar (mean) baseball football basketball hockey ///
[pweight=teamweight], over(race) title(Sport Frames) ///
subtitle("Mean scores by Group ID") ysc(r(1) titleg(1)) ///
ylab(0(25)100) blabel(bar, position(center) format(%4.0g) size(3) ///
color(white)) bargap(-15) legend(label(1 "Baseball") label(2 "Football") ///
label(3 "Basketball") label(4 "Hockey") size(2.5) rowgap(*.45) pos(6) ///
rows(1) region(style(legend) fcolor(gs15) margin(medsmall)) colgap(*.75) ///
symxsize(*.75) keygap(*.33)) ytitle(thermometer)
graph save sports2.gph, replace	
		
		
**Table 3: "Predictors of US Frame Clusters, Linear Regression Estimates"

	svy: logistic trump i.religious##c.factor1 i.religious##c.factor2 ///
	i.religious##c.factor3 age education income female interest i.white pid ///
	conservative
	eststo trump4

esttab trump1 wall1 trump2 wall2 trump3 wall3 trump4 wall4 using ///
regression.rtf, replace nogap onecell ///
title("Predictors of US Frame Clusterings, Linear Regression Estimates") ///
nonumbers mtitles("Trump Vote" "Wall Support" "Trump Vote" "Wall Support" ///
"Trump Vote" "Wall Support" "Trump Vote" "Wall Support") ///
addnote("Source: 2008 CCES UT Austin Module") incelldelimiter( ) compress ///
label nobaselevels star (+ .10 * .05 ** .01 *** .001) se(2) b(2) noeqlines			
				
		